appchooserdialog: Don't show broken subtitles
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 1 May 2020 15:01:34 +0000 (17:01 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 1 May 2020 16:21:53 +0000 (18:21 +0200)
Commit 07beb6dba29 made GtkAppChooserWidget useful with no content-type,
however when used in a GtkAppChooserDialog, this will lead to a confusing
"Opening (null) files" subtitle.

Fix this by omitting the subtitle altogether in that case.

gtk/gtkappchooserdialog.c

index 8dcd8a7de9500867d9fc7989d11e9902ae3fc5f4..f9fa24328032c55021b89696f3036965f2fe1466 100644 (file)
@@ -200,16 +200,18 @@ set_dialog_properties (GtkAppChooserDialog *self)
       unknown = g_content_type_is_unknown (self->content_type);
     }
 
+  title = g_strdup (_("Select Application"));
+  subtitle = NULL;
+  string = NULL;
+
   if (name != NULL)
     {
-      title = g_strdup (_("Select Application"));
       /* Translators: %s is a filename */
       subtitle = g_strdup_printf (_("Opening “%s”."), name);
       string = g_strdup_printf (_("No applications found for “%s”"), name);
     }
-  else
+  else if (self->content_type)
     {
-      title = g_strdup (_("Select Application"));
       /* Translators: %s is a file type description */
       subtitle = g_strdup_printf (_("Opening “%s” files."), 
                                   unknown ? self->content_type : description);